#include <stdio.h>
#include "m_Calculate.h"
#include"z_Randomnumber.h"
#include"w_Randomop.h"
#include"t_Randomevaluation.h"
#include"l_Randomwrongevaluation.h"

int main() {
    int a, b, answer, i, rightnumber, flag;
    char op;
    srand(time(NULL));
    do
    {
        rightnumber = flag = 0;
        for (i = 0; i < 10; i++)
        {
            a = z_Randomnumber();
            b = z_Randomnumber();
            op = w_Randomop();
            printf("%d %c %d=?\n", a, op, b);
            scanf_s("%d", &answer);
            if (answer == m_Calculate(a, op, b))
            {
                t_Randomevaluation();
                rightnumber++;
            }
            else
            {
                l_Randomwrongevaluation();
            }
        }
            printf("Total score is %d\n", rightnumber * 10);
            printf("Rate of correctness is %d%%\n", rightnumber * 10);
            if (rightnumber * 10 < 75)
            {
                printf("Once Again!\n");
                rightnumber = 0;
                flag = 1;
            }
        }while (flag);
        return 0;
    }